//每日订单数量
var orderNumChart = echarts.init(document.getElementById('orderNum'));
orderNumChart.setOption({
    title: {
        left: 'left',
        top: '8%',
        text: '网约车每日订单数',
        textStyle: {
            color: '#fff',
            textShadowBlur: 3,
            textShadowOffsetY: 3,
        }
    },
    tooltip: {},
    grid: {
        left: '17%',
        top: '28%',
        height: '55%'
    },
    xAxis: {
        data: [],
        nameTextStyle: {
            color: '#fff'
        },
        axisLine: {
            symbol: ['none', 'arrow'],
            lineStyle: {
                color: '#0099FF'
                // type:
            }
        },
        axisLabel: {
            textStyle: {
                color: '#fff'
            }
        },
        axisTick: {
            lineStyle: {
                color: '#0099FF'
            }
        }
    },
    yAxis: {
        axisLine: {show: false},
        axisTick: {show: false},
        axisLabel: {
            textStyle: {
                color: '#fff'
            }
        },
        splitLine: {
            lineStyle: {
                color: '#0099FF'
            }
        }
    },
    series: [{
        name: '订单数',
        type: 'bar',
        data: [],
        itemStyle: {
            normal: {
                color: new echarts.graphic.LinearGradient(
                    0, 0, 0, 1,
                    [
                        {offset: 0, color: '#5cf7fc'},
                        {offset: 1, color: '#00a4e0'}
                    ]
                )
            }
        }
    }]
});
orderNumChart.showLoading();
var orderNumDays = [];
var orderNumCounts = [];
$.ajax({
    type: "POST",
    async: true,
    url: "OrderNumServlet",
    data: {},
    dataType: "json",
    success: function (resultOfNum) {
        if (resultOfNum) {
            for (var i = 0; i < resultOfNum.length; i++) {
                orderNumDays.push(resultOfNum[i].day);
                orderNumCounts.push(resultOfNum[i].count);
            }
            orderNumChart.hideLoading();
            orderNumChart.setOption({
                xAxis: {
                    data: orderNumDays
                },
                series: [{
                    name: '订单数',
                    data: orderNumCounts
                }]
            })
        }
    },
    error: function (errorMsg) {
        alert("ERROR!!!!");
        orderNumChart.hideLoading();
    }
})